/*
The MIT License (MIT)

Copyright (c) 2013 Mike Dapiran, Brian May, Richard Pospesel, and Bert Wierenga

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software 
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#pragma once

namespace hhd
{
	class PrintStream;

	class Color
	{
	public:
		/**
		* Default constructor sets color to white.
		*/
		Color();

		/**
		* Creates rgba from another Color
		*/
		Color(const Color& other);
		/**
		* Define a color with RGB values which range from 0-255.  Alpha is set to fully opaque by default.
		*/
		Color(unsigned char red, unsigned char green, unsigned char blue);
		/**
		* Define a color with RGB and Alpha values which range from 0-255.
		*/
		Color(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha);
		/**
		* Define a color with RGB values which range from 0.0f to 1.0f.  Values outside this range get clamped.
		*/
		Color(float red, float green, float blue, float alpha);

		/**
		* copies from a float4 reference
		*/
		Color( const float* data );

		/**
		* Define a color with RGB and Alpha values which range from 0.0f to 1.0f.  Values outside this range get clamped.
		*/
		Color(float red, float green, float blue);
		/**
		* Define a color with RGB as an int value so we can use raw hex IE 0xFFFFFF for white.  Alpha is set to fully opaque.
		*/
		Color(int rgb);
		/**
		* Define a color with RGB as an int value so we can use raw hex IE 0xFFFFFF for white.  Alpha can be set on the range 0-255.
		*/
		Color(int rgb, char alpha);
			
		/** Return a float pointer of color data in RGBA format **/
		operator float*();
		operator const float*() const;
		Color& operator=(const Color& right);

		friend PrintStream& operator<<(PrintStream& in_stream, const Color& in_v);

		float red() const;
		float green() const;
		float blue() const;
		float alpha() const;
	private:
			
	public:
		float _red;
		float _green;
		float _blue;
		float _alpha;

		static const Color& black;
		static const Color& black_clear;
	};
}